xen/arm: bitops: Implement a new set of helpers that can timeout
authorJulien Grall <julien.grall@arm.com>
Mon, 29 Apr 2019 14:05:23 +0000 (15:05 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 14 Jun 2019 13:38:40 +0000 (14:38 +0100)
commite9f7dfac879ea1a66b4efceb533e8832994edadf
tree9b6ed239488e08a02c3b7720cd47367f4a78264b
parent632e87512e75cb9e3549662b79c9100cd30aaa8b
xen/arm: bitops: Implement a new set of helpers that can timeout

Exclusive load-store atomics should only be used between trusted
threads. As not all the guests are trusted, it may be possible to DoS
Xen when updating shared memory with guest atomically.

To prevent the infinite loop, we introduce a new set of helpers that can
timeout. The timeout is based on the maximum number of iterations.

They will be used in follow-up patch to make atomic operations
on shared memory safe.

This is part of XSA-295.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/arm32/lib/bitops.c
xen/arch/arm/arm64/lib/bitops.c
xen/include/asm-arm/bitops.h